﻿/*
 * RM2 Character Generator
 * Copyright (C) 2009 James Culshaw
 * 
 * This program is free software; you can redistribute it and/or modify it under the terms of 
 * the GNU General Public License as published by the Free Software Foundation; either version 2 
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program; 
 * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RMCharGen.Data
{
    internal sealed class Skill
    {
        private string _statOne = String.Empty;
        private string _statTwo = String.Empty;
        private string _statThree = String.Empty;

        private const string InvalidStatTypemessage = "{0} is not a valid Stat Type";

        private void ValidateStat(string stat)
        {
            bool valid = false;

            switch (stat)
            {
                case "":
                    valid = true;
                    break;
                case "CO":
                    valid = true;
                    break;
                case "AG":
                    valid = true;
                    break;
                case "SD":
                    valid = true;
                    break;
                case "Me":
                    valid = true;
                    break;
                case "Re":
                    valid = true;
                    break;
                case "St":
                    valid = true;
                    break;
                case "Qu":
                    valid = true;
                    break;
                case "Pr":
                    valid = true;
                    break;
                case "In":
                    valid = true;
                    break;
                case "EM":
                    valid = true;
                    break;
                default:
                    valid = false;
                    break;
            }

            if (!valid)
            {
                throw new InvalidStatTypeException(string.Format(InvalidStatTypemessage, stat));
            }
        }

        internal string Name { get; set; }
        
        internal string StatOne 
        { 
            get
            {
                return _statOne;
            }
            set
            {
                ValidateStat(value);
                _statOne = value;
            } 
        }

        internal string StatTwo
        {
            get
            {
                return _statTwo;
            }
            set
            {
                ValidateStat(value);
                _statTwo = value;
            }
        }

        internal string StatThree
        {
            get
            {
                return _statThree;
            }
            set
            {
                ValidateStat(value);
                _statThree = value;
            }
        }

        internal string TypeOne { get; set; }
        internal string TypeTwo { get; set; }

        internal bool IsPrimary { get; set; }

        internal Skill()
        {
            this.Name = String.Empty;
            this.TypeOne = String.Empty;
            this.TypeTwo = String.Empty;
            this.IsPrimary = false;
        }
    }
}
